home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / ifp1s157.zip / PAGE_06.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-26  |  40KB  |  1,221 lines

  1. unit page_06;
  2.  
  3. interface
  4.  
  5. uses crt, dos, graph, ifpglobl, ifpcomon, ifpextrn;
  6.  
  7. procedure page06;
  8.  
  9. implementation
  10.  
  11. procedure page06;
  12. const
  13.   atividmons: array[0..15] of string[24] =
  14.                ('EGA', 'analog monochrome', 'TTL monochrome', 'analog color',
  15.                 'RGB color', 'Multisync or compatible', '(unknown)',
  16.                 'PS/2 8514 or compatible', 'Seiko 1430', 'MultiSync 2A',
  17.                 'Tatung OmniScan', 'NEC 3D or compatible', 'TVM 3M',
  18.                 'NEC MultiSync XL/+/4D/5D', 'TVM 2A', 'TVM 3A');
  19.   trividmons: array[0..7] of string[17] =
  20.                ('MDA', 'CGA', 'EGA', 'Digital multisync', 'VGA', '8514',
  21.                 'SuperVGA', 'Analog multisync');
  22.   parachips: array[1..4] of string[7] =
  23.                ('PVGA1A', 'WD90C00', 'WD90C10', 'WD90C11');
  24.  
  25.  
  26. type
  27.   cardtype = (none, vesa, standard, paradise, video7, ati, ahead, cirrus,
  28.                cti, genoa, trident, tseng, zymos);
  29.   VESAitype = record
  30.                 signature: array[0..3] of char;
  31.                 version: word;
  32.                 OEMnameOfs: word;
  33.                 OEMnameSeg: word;
  34.                 capabilities: array[0..3] of byte;
  35.                 modesOfs: word;
  36.                 modesSeg: word;
  37.                 reserved: array[0..237] of byte;
  38.               end;
  39.   VESAmtype = record
  40.                 modeattr: word;
  41.                 winaattr: byte; {Window A attributes}
  42.                 winbattr: byte; {Window B attributes}
  43.                 wingran: word;  {Window Granularity}
  44.                 winsize: word;  {Window Size}
  45.                 winaseg: word;  {Window A segment}
  46.                 winbseg: word;  {Window B segment}
  47.                 posOfs: word;   {Offset of Far call to positioning function}
  48.                 posSeg: word;   {Segment ..}
  49.                 scansize: word; {Bytes per scan line}
  50.                 {The following information is optional for VESA modes,
  51.                  required for OEM modes}
  52.                 pixwidth: word;
  53.                 pixheight: word;
  54.                 charwidth: byte;
  55.                 charheight: byte;
  56.                 memplanes: byte;
  57.                 pixelbits: byte;
  58.                 banks: byte;
  59.                 memmodel: byte;
  60.                 banksize: byte;
  61.                 imagepages: byte;
  62.                 reserved0a: byte;
  63.                 {The following is part of VESA 1.2 and newer}
  64.                 RedMaskSize: byte;
  65.                 RedFieldPos: byte;
  66.                 GrnMaskSize: byte;
  67.                 GrnFieldPos: byte;
  68.                 BluMaskSize: byte;
  69.                 BluFieldPos: byte;
  70.                 RsrvdMaskSize: byte;
  71.                 RsrvdMaskPos: byte;
  72.                 DirectColorInfo: byte;
  73.                 Reserved0b: byte;
  74.                 reserved: array[0..215] of byte;
  75.               end;
  76.  
  77. ATIvidtype = record
  78.                columns: byte;
  79.                maxrow: byte;
  80.                lines_a_row: byte;
  81.                buffer_size: word;
  82.                seqreg: array[1..4] of byte;
  83.                miscreg: byte;
  84.                crtsreg: array[0..$18] of byte;
  85.                attrreg: array[0..$13] of byte;
  86.                graphreg: array[0..8] of byte;
  87.              end;
  88.  
  89. var
  90.   i : byte;
  91.   VGAbuf : array[$00..$10] of byte;
  92.   VESAinfo: VESAitype;
  93.   VESAmode: VESAmtype;
  94.   xbyte, xbyte2, xbyte3, paralock1, paralock2: byte;
  95.   xword1 : word;
  96.   xword2 : word;
  97.   xword3 : word;
  98.   xword4 : word;
  99.   vgacard: cardtype;
  100.   vidmem : word;
  101.   s: string;
  102.   c: char;
  103.   saveattr, savex, savey: byte;
  104.   foundone, foundit: boolean;
  105.  
  106. procedure captfont;
  107.   begin
  108.   caption1('Font           Address');
  109.   Writeln;
  110.   Write('INT 1FH        ');
  111.   segofs(longint(intvec[$1F]) shr 16, longint(intvec[$1F]) and $0000FFFF);
  112.   Writeln
  113.   end; {captfont}
  114.  
  115. procedure showfont(a : byte);
  116.   const
  117.     fontnames: array [0..7] of string[12] = (
  118.                  'INT 1FH     ',
  119.                  'INT 43H     ',
  120.                  'ROM 8x14    ',
  121.                  'ROM 8x8 (lo)',
  122.                  'ROM 8x8 (hi)',
  123.                  'ROM 9x14    ',
  124.                  'ROM 8x16    ',
  125.                  'ROM 9x16    ');
  126.  
  127.   begin
  128.   with regs do
  129.     begin
  130.     Write(fontnames[a], '   ');
  131.     AX:=$1130;
  132.     BH:=a;
  133.     intr($10, regs);
  134.     segofs(ES, BP);
  135.     Writeln
  136.     end
  137.   end; {showfont}
  138.  
  139. procedure int101210;
  140.   const
  141.     memnames: array[0..3] of string[4] = ('64K', '128K', '192K', '256K');
  142.  
  143.   begin
  144.   with regs do
  145.     begin
  146.     AH:=$12;
  147.     BL:=$10;
  148.     intr($10, regs);
  149.     caption2('Display type');
  150.     case BH of
  151.       $00 : Writeln('color');
  152.       $01 : Writeln('monochrome')
  153.       else
  154.         unknown('display', BH, 2)
  155.     end;
  156.     caption2('Memory');
  157.     if vidmem > 0 then
  158.       Writeln(vidmem, 'K')
  159.     else
  160.       if BL < 4 then
  161.         Writeln(memnames[BL], ' as determined from standard BIOS call')
  162.       else
  163.         unknown('size', BL, 2);
  164.     if vgacard = none then
  165.       begin
  166.       caption2('Feature bits');
  167.       Writeln(bin4(CH and $0F));
  168.       caption2('DIP switches (EGA)');
  169.       Writeln(bin4(CL and $0F))
  170.       end
  171.     end
  172.   end;
  173.  
  174.   function readROM(seg, ofs: word; length: byte): string;
  175.     var
  176.       x: word;
  177.       s: string;
  178.  
  179.     begin
  180.     s:='';
  181.     for x:=ofs to ofs + (length - 1) do
  182.       s:=s + Chr(Mem[seg:x]);
  183.     readROM:=s
  184.     end; {readROM}
  185.  
  186.   procedure checking(s: string);
  187.     var
  188.       x, y: byte;
  189.     begin
  190.     x:=WhereX;
  191.     y:=WhereY;
  192.     ClrEol;
  193.     Write('Checking for ', s);
  194.     GotoXY(x, y);
  195.     end; {checking}
  196.  
  197.   procedure d8or16bit(b: boolean);
  198.     begin
  199.     if b then
  200.       Write('8-bit')
  201.     else
  202.       Write('16-bit');
  203.     end;
  204.  
  205.   procedure cli;
  206.     inline($FA);
  207.  
  208.   procedure sti;
  209.     inline($FB);
  210.  
  211.   function isXGA: word;
  212.     var
  213.       POSport, cardID, tmpw: word;
  214.       tmp, tmp1, tmp2, tmp3, tmp4: byte;
  215.       slot: byte;
  216.       regs: registers;
  217.       foundit: boolean;
  218.  
  219.     begin
  220.     isXGA:=0;
  221.     foundit:=false;
  222.     with regs do
  223.       begin
  224.       DX:=$FFFF;
  225.       AX:=$C400;
  226.       Intr($15, regs);
  227.       if (not nocarry(regs)) or (DX = -1) then
  228.         Exit;
  229.       posport:=DX;
  230.       slot:=0;
  231.       repeat
  232.         cli;
  233.         if slot = 0 then
  234.           Port[$94]:=$DF
  235.         else
  236.           begin
  237.           AX:=$C401;
  238.           BX:=slot;
  239.           Intr($15, regs)
  240.           end;
  241.         cardID:=PortW[POSport];
  242.         tmp1:=Port[POSport + 2];
  243.         tmp2:=Port[POSport + 3];
  244.         tmp3:=Port[POSport + 4];
  245.         tmp4:=Port[POSport + 5];
  246.         if slot = 0 then
  247.           Port[$94]:=$FF
  248.         else
  249.           begin
  250.           AX:=$C402;
  251.           BX:=slot;
  252.           Intr($15, regs);
  253.           end;
  254.         cli;
  255.         if (cardID >= $8FD8) and (cardID <= $8FDB) then
  256.           begin
  257.           tmpw:=tmp1 and $E;
  258.           POSport:=(tmpw shl 3) + $2100;
  259.           Port[POSport + $A]:=$52;
  260.           tmp:=Port[POSport + $B] and $F;
  261.           if (tmp <> 0) and (tmp <> $F) then
  262.             foundit:=true
  263.           else
  264.             Inc(slot);
  265.           end
  266.         else
  267.           Inc(slot);
  268.       until foundit or (slot > 9);
  269.       end;
  270.     if foundit then
  271.       isXGA:=POSport;
  272.     end; {isXGA}
  273.  
  274.   procedure isport2(var regs: registers; var foundit: boolean);
  275.     var
  276.       savebx, saveax: word;
  277.       tmp: byte;
  278.  
  279.     begin
  280.     with regs do
  281.       begin
  282.       savebx:=BX;
  283.       BX:=AX;
  284.       Port[DX]:=AL;
  285.       AH:=AL;
  286.       AL:=Port[DX + 1];
  287.       tmp:=AH;
  288.       AH:=AL;
  289.       AL:=tmp;
  290.       saveax:=AX;
  291.       AX:=BX;
  292.       PortW[DX]:=AX;
  293.       Port[DX]:=AL;
  294.       AH:=AL;
  295.       AL:=Port[DX + 1];
  296.       AL:=AL and BH;
  297.       foundit:=(AL = BH);
  298.       if AL = BH then
  299.         begin
  300.         AL:=AH;
  301.         AH:=0;
  302.         Port[DX]:=AX;
  303.         Port[DX]:=AL;
  304.         AH:=AL;
  305.         AL:=Port[DX + 1];
  306.         AL:=AL and BH;
  307.         foundit:=(AL = 0);
  308.         end;
  309.       AX:=saveax;
  310.       PortW[DX]:=AX;
  311.       BX:=savebx;
  312.       end;
  313.     end;
  314.  
  315.   begin (* procedure page_06 *)
  316.   vgacard:=none;
  317.   caption2('Display adapter');
  318.   checking('VESA');
  319.   with regs do
  320.     begin
  321.     AX:=$4F00;
  322.     ES:=Seg(VESAinfo);
  323.     DI:=Ofs(VESAinfo);
  324.     Intr($10, regs);
  325.     s:='';
  326.     if (AL = $4F) and (AH = 0) and (VESAinfo.signature = 'VESA') then
  327.       begin
  328.       with VESAinfo do
  329.         begin
  330.         vgacard:=vesa;
  331.         ClrEol;
  332.         Writeln('VESA version ', Hi(version), decimal, Lo(version));
  333.         caption2('OEM ID');
  334.         xword1:=OEMnameSeg;
  335.         xword2:=OEMnameOfs;
  336.         s:='';
  337.         c:=Chr(Mem[xword1:xword2]);
  338.         while c <> #0 do
  339.           begin
  340.           Write(c);
  341.           s:=s + c;
  342.           Inc(xword2);
  343.           c:=Chr(Mem[xword1:xword2])
  344.           end;
  345.         caption3('Manufacturer');
  346.         if s = '761295520' then
  347.           Writeln('ATI')
  348.         else
  349.           Writeln(s)
  350.         end;
  351.       caption1('Video modes supported:');
  352.       Writeln;
  353.       xword2:=VESAinfo.modesSeg;
  354.       xword3:=VESAinfo.modesOfs;
  355.       with VESAmode do
  356.         while MemW[xword2:xword3] <> $FFFF do
  357.           begin
  358.           xword1:=MemW[xword2:xword3];
  359.           pause3(3);
  360.           if endit then
  361.             Exit;
  362.           caption2('Number');
  363.           Write(hex(xword1, 4));
  364.           AX:=$4F01;
  365.           CX:=xword1;
  366.           ES:=Seg(VESAmode);
  367.           DI:=Ofs(VESAmode);
  368.           Intr($10, regs);
  369.           if (AX = $004F) and (modeattr and 1 = 1) then
  370.             begin
  371.             caption3('Mode');
  372.             if modeattr and 8 = 8 then
  373.               Write('Color ')
  374.             else
  375.               Write('Monochrome ');
  376.             if modeattr and $10 = $10 then
  377.               Write('graphics')
  378.             else
  379.               Write('text');
  380.             caption3('BIOS output support');
  381.             yesorno(modeattr and 4 = 4);
  382.             if modeattr and 2 = 2 then
  383.               begin
  384.               caption3('Screen size');
  385.               Write(pixwidth, 'x', pixheight);
  386.               caption3('Character size');
  387.               Write(charwidth, 'x', charheight);
  388.               caption3('Colors');
  389.               Writeln(exp((pixelbits * 1.0) * ln(2.0)):1:0);
  390.               caption3('Memory model');
  391.               case memmodel of
  392.                 0: Write('Text');
  393.                 1: Write('CGA');
  394.                 2: Write('Hercules');
  395.                 3: Write('4-plane');
  396.                 4: Write('Packed-pixel');
  397.                 5: Write('Nonchain 4');
  398.                 6: Write('direct color');
  399.                 7: Write('YUV');
  400.                 8..$0F: Write('(reserved)');
  401.               else
  402.                 Write('(unknown)')
  403.               end;
  404.               caption3('Memory planes');
  405.               Write(memplanes);
  406.               caption3('Memory banks');
  407.               Write(banks);
  408.               if banks > 1 then
  409.                 begin
  410.                 caption3('Bank size');
  411.                 Write(banksize, 'K')
  412.                 end;
  413.               end
  414.             end
  415.           else
  416.             Caption1('  No available information on this mode.');
  417.           Inc(xword3, 2);
  418.           Writeln;
  419.           end;
  420.       TextColor(LightGreen);
  421.       Write('The next screen will show standard information, so ');
  422.       pause1;
  423.       if endit then
  424.         Exit;
  425.       ClrScr;
  426.       caption2('Display adapter');
  427.       end;
  428.     end;
  429.   vgacard:=none;
  430.   vidmem:=0;
  431.   ClrEol;
  432.   case graphdriver of
  433.     CGA : begin
  434.           Writeln('CGA');
  435.           captfont
  436.           end;
  437.     MCGA : begin
  438.            Writeln('MCGA');
  439.            captfont;
  440.            showfont($01);
  441.            showfont($03);
  442.            showfont($04);
  443.            showfont($06)
  444.            end;
  445.     EGA..EGAmono : begin
  446.                  Writeln('EGA');
  447.                  captfont;
  448.                  showfont($01);
  449.                  showfont($02);
  450.                  showfont($03);
  451.                  showfont($04);
  452.                  showfont($05);
  453.                  int101210;
  454.                  xbyte:=mem[BIOSdseg : $0087];
  455.                  caption2('Mode change preserves screen buffer');
  456.                  yesorno(xbyte and $80 = $80);
  457.                  caption2('EGA active');
  458.                  yesorno(xbyte and $08 = $00);
  459.                  caption2('Wait for display enable');
  460.                  yesorno(xbyte and $04 = $04);
  461.                  caption2('CGA cursor emulation');
  462.                  yesorno(xbyte and $01 = $00);
  463.            (*  PC Magazine 6:12 p.326  *)
  464.                  caption2('Save area                    ');
  465.                  xword1:=memw[BIOSdseg : $00AA];
  466.                  xword2:=memw[BIOSdseg : $00A8];
  467.                  segofs(xword1, xword2);
  468.                  Writeln;
  469.            (*  PC Tech Journal 3:4 p.65  *)
  470.                  caption2('Video parameter table        ');
  471.                  segofs(memw[xword1 : xword2 +  2], memw[xword1 : xword2]);
  472.                  Writeln;
  473.                  caption2('Dynamic save area            ');
  474.                  xword3:=memw[xword1 : xword2 +  6];
  475.                  xword4:=memw[xword1 : xword2 +  4];
  476.                  if (xword3 > $0000) or (xword4 > $0000) then
  477.                    begin
  478.                    segofs(xword3, xword4);
  479.                    Writeln
  480.                    end
  481.                  else
  482.                    Writeln('(none)');
  483.                  caption2('Auxiliary character generator');
  484.                  xword3:=memw[xword1 : xword2 + 10];
  485.                  xword4:=memw[xword1 : xword2 +  8];
  486.                  if (xword3 > $0000) or (xword4 > $0000) then
  487.                    begin
  488.                    segofs(xword3, xword4);
  489.                    Writeln
  490.                    end
  491.                  else
  492.                    Writeln('(none)');
  493.                  caption2('Graphics mode auxiliary table');
  494.                  xword3:=memw[xword1 : xword2 + 14];
  495.                  xword4:=memw[xword1 : xword2 + 12];
  496.                  if (xword3 > $0000) or (xword4 > $0000) then
  497.                    segofs(xword3, xword4)
  498.                  else
  499.                    Write('(none)')
  500.            (*  PC Tech Journal 3:4 p.67  *)
  501.                end;
  502.     hercmono : begin
  503.                Writeln('Hercules or MDA');
  504.                captfont
  505.                end;
  506.     IBM8514 : begin
  507.               Writeln('IBM 8514');
  508.               captfont
  509.               end;
  510.     ATT400 : begin
  511.              Writeln('AT&T 400');
  512.              captfont
  513.              end;
  514.     VGA : begin
  515.           if novgacheck then
  516.             begin
  517.             Writeln('VGA');
  518.             caption3('Chipset');
  519.             Writeln('Detection blocked by NV command-line switch!');
  520.             end
  521.           else
  522.             begin
  523.             xword1:=isXGA;
  524.             if xword1 > 0 then
  525.               if Port[xword1] and 1 = 1 then
  526.                 Writeln('XGA')
  527.               else
  528.                 Writeln('VGA, XGA on other monitor')
  529.             else
  530.               Writeln('VGA');
  531.             vidmem:=0;
  532.             caption3('Chipset');
  533.             vgacard:=standard;
  534.             if vgacard = standard then
  535.               begin
  536.               checking('Video 7');
  537.               if Port[$3CC] and 1 = 1 then
  538.                 xword1:=$3D0
  539.               else
  540.                 xword1:=$3B0;
  541.               Port[xword1 + 4]:=$C;
  542.               i:=Port[xword1 + 5];
  543.               Port[xword1 + 5]:=$55;
  544.               xbyte:=Port[xword1 + 5];
  545.               Port[xword1 + 4]:=$1F;
  546.               xbyte2:=Port[xword1 + 5];
  547.               Port[xword1 + 4]:=$C;
  548.               Port[xword1 + 5]:=i;
  549.               if xbyte2 = $55 xor $EA then
  550.                 begin
  551.                 vgacard:=video7;
  552.                 ClrEol;
  553.                 Write('Video 7 - ');
  554.                 port[$3C4]:=$8E;
  555.                 xbyte:=Port[$3C5];
  556.                 case xbyte of
  557.                   $80..$FF: Writeln('Vega VGA');
  558.                   $70..$7F: with regs do
  559.                               begin
  560.                               AX:=$6F07;
  561.                               Intr($10, regs);
  562.                               if (AH and $80) = $80 then
  563.                                 Writeln('VRAM')
  564.                               else
  565.                                 Writeln('FastWrite');
  566.                               end;
  567.                   $50..$59: Writeln('VGA Version 5');
  568.                   $40..$49: Writeln('1024i')
  569.                 else
  570.                   Writeln('unknown value $', hex(xbyte, 2));
  571.                 end;
  572.                 caption3('  Chip revision');
  573.                 Port[$3C4]:=$8E;
  574.                 Write(Port[$3C5]);
  575.                 Port[$3C4]:=$FF;
  576.                 xbyte:=Port[$3C5];
  577.                 with regs do
  578.                   begin
  579.                   AX:=$6F07;
  580.                   Intr($10, regs);
  581.                   if AL = $6F then
  582.                     begin
  583.                     vidmem:=256 * (AH and $7F);
  584.                     caption3('Memory type');
  585.                     if AH and $80 = $80 then
  586.                       Writeln('VRAM')
  587.                     else
  588.                       Writeln('DRAM')
  589.                     end
  590.                   else
  591.                     vidmem:=256;
  592.                   end;
  593.                 caption3('  Memory');
  594.                 d8or16bit((xbyte and 1) = 0);
  595.                 caption3('I/O');
  596.                 d8or16bit((xbyte and 2) = 0);
  597.                 caption3('BIOS');
  598.                 d8or16bit((xbyte and 8) = 0);
  599.                 caption3('bus');
  600.                 caption3('Fast-Write');
  601.                 yesorno((xbyte and 4) = 4);
  602.                 end;
  603.               end;
  604.             if vgacard = standard then
  605.               begin
  606.               checking('AHEAD');
  607.               s:=readROM($C000, $25, 5);
  608.               if s = 'AHEAD' then
  609.                 begin
  610.                 vgacard:=ahead;
  611.                 ClrEol;
  612.                 Writeln('Ahead');
  613.                 end
  614.               end;
  615.             if vgacard = standard then
  616.               begin
  617.               checking('Genoa');
  618.               s:=readROM($C000, MemW[$C000:$37], 4);
  619.               if (s[1] = #$77) and (Copy(s, 3, 2) = #$99#$66) then
  620.                 begin
  621.                 vgacard:=genoa;
  622.                 ClrEol;
  623.                 Write('Genoa ');
  624.                 case Ord(s[2]) of
  625.                   $33: Write('5100/5200 (Tseng ET3000 based)');
  626.                   $55: Write('5300/5400 (Tseng ET3000 based)');
  627.                   $22: Write('6100');
  628.                   $00: Write('6200/6300');
  629.                   $11: Write('6400/6600')
  630.                 else
  631.                   Write('(unknown type - $', hex(Ord(s[2]), 2), ')');
  632.                 end;
  633.                 Writeln;
  634.                 if (s[2] = #$33) or (s[2] = #$55) then
  635.                   begin
  636.                   end
  637.                 else
  638.                   begin
  639.                   Port[$3C4]:=5;
  640.                   xbyte:=Port[$3C5];
  641.                   caption3('  Bus');
  642.                   if (xbyte and 1) = 1 then
  643.                     Write('PC')
  644.                   else
  645.                     Write('MCA');
  646.                   caption3('Video width');
  647.                   d8or16bit((xbyte and 2) = 2);
  648.                   caption3('BIOS width');
  649.                   d8or16bit((xbyte and 4) = 4);
  650.                   caption3('I/O ports at');
  651.                   if (xbyte and $10) = $10 then
  652.                     Writeln('$3xx')
  653.                   else
  654.                     Writeln('$2xx');
  655.                   caption3('  BIOS size');
  656.                   case (xbyte and $60) shr 5 of
  657.                     0, 3: Write('24K');
  658.                     1: Write('30K');
  659.                     2: Write('32K')
  660.                   end;
  661.                   Port[$3C4]:=7;
  662.                   xbyte:=Port[$3C5];
  663.                   caption3('Monitor type');
  664.                   if (xbyte and $20) = $20 then
  665.                     Write('TTL digital')
  666.                   else
  667.                     Write('analog');
  668.                   caption3('Chipset on');
  669.                   if (xbyte and 8) = 8 then
  670.                     Writeln('motherboard')
  671.                   else
  672.                     Writeln('adapter card');
  673.                   Port[$3C4]:=$10;
  674.                   xbyte:=Port[$3C5];
  675.                   caption3('  Fast scroll');
  676.                   yesorno2((xbyte and 1) = 1);
  677.                   caption3('Fast address');
  678.                   yesorno2((xbyte and 2) = 2);
  679.                   caption3('Fast write');
  680.                   yesorno((xbyte and $40) = $40);
  681.                   Port[$3C4]:=8;
  682.                   xbyte:=Port[$3C5];
  683.                   caption3('  70Hz vertical retrace');
  684.                   yesorno2((xbyte and $10) = $10);
  685.                   xword1:=MemW[$40:$63];
  686.                   Port[xword1]:=$2F;
  687.                   xbyte:=Port[xword1 + 1];
  688.                   caption3('Interlaced');
  689.                   yesorno((xbyte and 1) = 1);
  690.                   end
  691.                 end
  692.               end;
  693.             if vgacard = standard then
  694.               begin
  695.               checking('Cirrus');
  696.               xword1:=CirrusCK;
  697.               if xword1 <> 0 then
  698.                 begin
  699.                 vgacard:=cirrus;
  700.                 ClrEol;
  701.                 Write('Cirrus');
  702.                 caption3('chipset type');
  703.                 case xword1 of
  704.                   $EC: Write('510/520');
  705.                   $CA: Write('610/620');
  706.                   $EA: Write('Video Seven')
  707.                 else
  708.                   Write('unknown - $', hex(xword1, 2))
  709.                 end;
  710.                 caption3('Cirrus BIOS');
  711.                 s:=readROM($C000, 6, 2);
  712.                 yesorno(s = 'CL');
  713.                 end;
  714.               end;
  715.             if vgacard = standard then
  716.               begin
  717.               checking('CTI');
  718.               Port[$46E8]:=$1E;
  719.               xbyte:=Port[$104];
  720.               Port[$46E8]:=$E;
  721.               if xbyte = $A5 then
  722.                 with regs do
  723.                   begin
  724.                   AH:=$5F;
  725.                   AL:=0;
  726.                   Intr($10, regs);
  727.                   ClrEol;
  728.                   Write('CTI 82C45');
  729.                   Port[$46E8]:=$1E;
  730.                   Port[$103]:=$80;
  731.                   Port[$46E8]:=$E;
  732.                   Port[$3D6]:=0;
  733.                   xbyte:=Port[$3D7];
  734.                   xbyte3:=(xbyte and $F0) shr 4;
  735.                   if xbyte3 = 1 then
  736.                     begin
  737.                     Port[$3D6]:=$3A;
  738.                     i:=Port[$3D7];
  739.                     Port[$3D7]:=$AA;
  740.                     xbyte2:=Port[$3D7];
  741.                     Port[$3D7]:=i;
  742.                     if xbyte2 = $AA then
  743.                       xbyte3:=2
  744.                     else
  745.                       xbyte3:=1;
  746.                     end;
  747.                   Port[$46E8]:=$1E;
  748.                   Port[$103]:=0;
  749.                   Port[$46E8]:=$E;
  750.                   Port[$3D6]:=0;
  751.                   Str(xbyte3:0, s);
  752.                   Writeln(s);
  753.                   vgacard:=CTI;
  754.                   case BH of
  755.                     0: vidmem:=256;
  756.                     1: vidmem:=512;
  757.                     2: vidmem:=1024;
  758.                   else
  759.                     vidmem:=0;
  760.                   end;
  761.                   caption3('  Chip revision');
  762.                   Writeln(xbyte and $0F);
  763.                   caption3('micro-channel');
  764.                   yesorno2(CX and 2 = 2);
  765.                   caption3('DAC size');
  766.                   if CX and 1 = 1 then
  767.                     Writeln('8-bit')
  768.                   else
  769.                     Writeln('6-bit');
  770.                   end;
  771.               end;
  772.             if vgacard = standard then
  773.               begin
  774.               checking('Trident');
  775.               Port[$3C4]:=$0B;
  776.               xbyte:=Port[$3C5];
  777.               if (xbyte <= 6) and (xbyte >= 2) then
  778.   {
  779.                 Port[$3C5]:=Port[$3C5];
  780.                 Port[$3C4]:=$0E;
  781.                 i:=Port[$3C5];
  782.                 Port[$3C5]:=0;
  783.                 xbyte:=Port[$3C5] and $0F;
  784.                 Port[$3C5]:=i;
  785.                 if xbyte = 2 then
  786.   }
  787.                 begin
  788.                 vgacard:=trident;
  789.                 ClrEol;
  790.                 Write('Trident ');
  791.   {
  792.                 Port[$3C4]:=$0B;
  793.                 Port[$3C5]:=0;
  794.                 xbyte3:=Port[$3C5];
  795.   }
  796.                 case xbyte of
  797.                   1: Writeln('8800BR');
  798.                   2: Writeln('8800CS')
  799.                 else
  800.                   begin
  801.                   Writeln('8900');
  802.                   Port[$3C4]:=$1F;
  803.                   xbyte:=Port[$3C5] and 3;
  804.                   case xbyte of
  805.                     0: vidmem:=256;
  806.                     1: vidmem:=512;
  807.                     2, 3: vidmem:=1024;
  808.                   end; {case}
  809.                   end;
  810.                 end;
  811.                 caption3('  BIOS');
  812.                 Port[$3C4]:=$F;
  813.                 xbyte:=Port[$3C5];
  814.                 d8or16bit((xbyte and $80) = 0);
  815.                 caption3('interlaced');
  816.                 Port[$3C4]:=$1E;
  817.                 xbyte:=Port[$3C5];
  818.                 yesorno((xbyte and $20) = $20);
  819.                 with regs do
  820.                   begin
  821.                   AX:=$7000;
  822.                   BX:=0;
  823.                   Intr($10, regs);
  824.                   if AL = $70 then
  825.                     begin
  826.                     caption3('Everex Card');
  827.                     DX:=(DX and $FFF0) shr 4;
  828.                     case DX of
  829.                       $678: Write('Viewpoint');
  830.                       $236: Write('Ultragraphics II');
  831.                       $620: Write('Vision VGA');
  832.                       $673: Write('EVGA')
  833.                     else
  834.                       dontknow2;
  835.                     end; {case}
  836.                     vidmem:=((CH shr 6) * 256) + 256;
  837.                     caption3('Monitor');
  838.                     if CL < 8 then
  839.                       Writeln(trividmons[CL])
  840.                     else
  841.                       Writeln('(unknown) - ', CL);
  842.                     end
  843.                   end;
  844.                 end;
  845.               end;
  846.             if vgacard = standard then
  847.               begin
  848.               checking('Tseng');
  849.               xbyte:=tsengCK;
  850.               if xbyte = 1 then
  851.                 begin
  852.                 ClrEol;
  853.                 Write('Tseng ET');
  854.                 if Port[$3CC] and 1 = 1 then
  855.                   xword:=$3D0
  856.                 else
  857.                   xword:=$3B0;
  858.                 Port[xword + 4]:=$33;
  859.                 xbyte:=Port[xword + 5];
  860.                 Port[xword + 5]:=xbyte xor $F;
  861.                 xbyte2:=Port[xword + 5];
  862.                 Port[xword + 5]:=xbyte;
  863.                 if xbyte2 = xbyte xor $F then
  864.                   begin
  865.                   Write('4000');
  866.                   Port[$3BF]:=3;
  867.                   Port[$3D8]:=$A0;
  868.                   with regs do
  869.                     begin
  870.                     AX:=$10F1;
  871.                     BL:=0;
  872.                     Intr($10, regs);
  873.                     if AL=$10 then
  874.                       case BL of
  875.                         0: Writeln(' w/ normal DAC');
  876.                         1: Writeln(' w/ SC1148x HiColor DAC');
  877.                         2: Writeln(' w/ new HiColor DAC')
  878.                       else
  879.                         Writeln(' w/ unknown HiColor DAC');
  880.                       end;
  881.                     end;
  882.                   Port[xword + 4]:=$37;
  883.                   xbyte:=Port[xword + 5];
  884.                   if xbyte and 8 = 0 then
  885.                     vidmem:=256
  886.                   else
  887.                     case xbyte and 3 of
  888.                       0,1: vidmem:=256;
  889.                       2: vidmem:=512;
  890.                       3: vidmem:=1024;
  891.                     end
  892.                   end
  893.                 else
  894.                   Write('3000');
  895.                 caption3('ROM');
  896.                 d8or16bit((xbyte and $10) = 0);
  897.                 caption3('Video');
  898.                 Port[xword + 4]:=$36;
  899.                 xbyte:=Port[xword + 5];
  900.                 d8or16bit((xbyte and $40) = 0);
  901.                 caption3('I/O');
  902.                 d8or16bit((xbyte and $80) = 0);
  903.                 Writeln;
  904.                 Port[xword + 4]:=$37;
  905.                 xbyte:=Port[xword + 5];
  906.                 caption3('Memory type');
  907.                 if xbyte and $80 = $80 then
  908.                   Write('VRAM')
  909.                 else
  910.                   Write('DRAM');
  911.                 Port[$3C4]:=7;
  912.                 xbyte:=Port[$3C5];
  913.                 caption3('Compatibility');
  914.                 if xbyte and $80 = $80 then
  915.                   Write('VGA')
  916.                 else
  917.                   Write('EGA');
  918.                 caption3('ROM address');
  919.                 if xbyte and $20 = 0 then
  920.                   if xbyte and 8 = 0 then
  921.                     Writeln('C000-C3FF')
  922.                   else
  923.                     Writeln('disabled')
  924.                 else
  925.                   if xbyte and 8 = 0 then
  926.                     Writeln('C000-C5FF and C680 - C7FF')
  927.                   else
  928.                     Writeln('C000-C7FF');
  929.                 vgacard:=tseng
  930.                 end;
  931.               end;
  932.             if vgacard = standard then
  933.               begin
  934.               checking('ZyMOS');
  935.               if zymosCK = 2 then
  936.                 begin
  937.                 ClrEol;
  938.                 Writeln('ZyMOS');
  939.                 vgacard:=zymos
  940.                 end;
  941.               end;
  942.             if vgacard = standard then
  943.               begin
  944.               checking('Oak');
  945.               with regs do
  946.                 begin
  947.                 DX:=$3DE;
  948.                 AX:=$FF11;
  949.                 isport2(regs, foundit);
  950.                 if foundit then
  951.                   begin
  952.                   ClrEol;
  953.                   Writeln('Oak');
  954.                   Port[$3DE]:=$D;
  955.                     asm
  956.                        jmp  @1
  957.                     @1:
  958.                     end;
  959.                   xbyte:=Port[$3DF];
  960.                   if xbyte and $80 = $80 then
  961.                     vidmem:=512
  962.                   else
  963.                     vidmem:=256;
  964.                   end;
  965.                 end;
  966.               end;
  967.             if vgacard = standard then
  968.               with regs do
  969.                 begin
  970.                 checking('ATI');
  971.                 s:=readROM($C000, $31, 9);
  972.                 if s = '761295520' then
  973.                   begin
  974.                   vgacard:=ati;
  975.                   ClrEol;
  976.                   Write('ATI ');
  977.                   c:=Chr(Mem[$C000:$43]);
  978.                   case c of
  979.                     '1': Write('18800');
  980.                     '2': Write('18800-1');
  981.                     '3': Write('28800-2');
  982.                     '4': Write('28800-4');
  983.                     '5': Write('28800-5');
  984.                     'a': Write('68875')
  985.                    else
  986.                      Write('"', c, '"???')
  987.                   end;
  988.                   caption3('Board');
  989.                   s:=readROM($C000, $40, 2);
  990.                   if s = '31' then
  991.                     if c = 'a' then
  992.                       Write('Ultra Pro')
  993.                     else
  994.                       Write('VGAWonder');
  995.                   if s = '32' then
  996.                     Write('EGAWonder 800+');
  997.                   caption3('Revision');
  998.                   Write(Mem[$C000:$4D], decimal);
  999.                   ZeroPad(Mem[$C000:$4C]);
  1000.                   xbyte:=Mem[$C000:$42];
  1001.                   caption3('mouse port');
  1002.                   yesorno(xbyte and 2 = 2);
  1003.                   caption3('programmable video clock');
  1004.                   yesorno2(xbyte and $10 = $10);
  1005.                   xword1:=MemW[$C000:$10];
  1006.                   xbyte:=ATIinfo($BB, xword1);
  1007.                   caption3('monitor');
  1008.                   Writeln(atividmons[xbyte and $0F]);
  1009.                   if c > '0' then
  1010.                     begin
  1011.                     xbyte:=Mem[$C000:$44];
  1012.                     caption3('70Hz non-interlace');
  1013.                     yesorno2(xbyte and 1 = 1);
  1014.                     caption3('Korean chars');
  1015.                     yesorno2(xbyte and 2 = 2);
  1016.                     caption3('Memory clock');
  1017.                     if (xbyte and 4 = 4) then
  1018.                       Writeln('45MHz')
  1019.                     else
  1020.                       Writeln('40MHz');
  1021.                     caption3('Zero wait state');
  1022.                     yesorno2(xbyte and 8 = 8);
  1023.                     caption3('Paged ROMs');
  1024.                     yesorno2(xbyte and $10 = $10);
  1025.                     caption3('8514/A');
  1026.                     yesorno2(xbyte and $40 <> $40);
  1027.                     caption3('HiColor DAC');
  1028.                     yesorno(xbyte and $80 = $80);
  1029.                     end;
  1030.                   caption3('Video modes');
  1031.                   xbyte2:=0;
  1032.                   foundone:=false;
  1033.                   for xbyte:=0 to 255 do
  1034.                     begin
  1035.                     AH:=$12;
  1036.                     AL:=xbyte;
  1037.                     BX:=$5506;
  1038.                     BP:=$FFFF;
  1039.                     Intr($10, regs);
  1040.                     if BP <> $FFFF then
  1041.                       begin
  1042.                       Write(hex(xbyte, 2), ' ');
  1043.                       Inc(xbyte2);
  1044.                       foundone:=true;
  1045.                       if xbyte2 = 21 then
  1046.                         begin
  1047.                         Writeln;
  1048.                         Write('               ');
  1049.                         xbyte2:=0;
  1050.                         end;
  1051.                       end;
  1052.                     end;
  1053.                   if (not foundone) or (foundone and (xbyte <> 0)) then
  1054.                     Writeln;
  1055.                   vidmem:=256;
  1056.                   if (c = '1') or (c = '2') then
  1057.                     begin
  1058.                     if ATIinfo($BB, xword1) and $20 = $20 then
  1059.                       vidmem:=512;
  1060.                     end
  1061.                   else
  1062.                     begin
  1063.                     xbyte:=ATIinfo($B0, xword1);
  1064.                     if xbyte and $10 = $10 then
  1065.                       vidmem:=512;
  1066.                     if c <> '3' then
  1067.                       if xbyte and 8 = 8 then
  1068.                         vidmem:=1024;
  1069.                     end;
  1070.                   end;
  1071.                 end;
  1072.             if vgacard = standard then
  1073.               begin
  1074.               checking('Paradise');
  1075.               s:=readROM($C000, $7D, 4);
  1076.               if s = 'VGA=' then
  1077.                 begin
  1078.                 vgacard:=paradise;
  1079.                 ClrEol;
  1080.                 Write('Western Digital/Paradise ');
  1081.                 Port[$3CE]:=$F;
  1082.                 paralock1:=Port[$3CF];
  1083.                 Port[$3CF]:=5;
  1084.                 Port[$3C4]:=7;
  1085.                 if Port[$3CC] and 1 = 1 then
  1086.                   xword:=$3D0
  1087.                 else
  1088.                   xword:=$3B0;
  1089.                 Port[xword + 4]:=$29;
  1090.                 paralock2:=Port[xword + 5];
  1091.                 Port[xword + 5]:=$85;
  1092.                 PortW[$3C4]:=$4806;
  1093.                 Port[xword + 4]:=$2B;
  1094.                 xbyte:=Port[xword + 5];
  1095.                 Port[xword + 5]:=$AA;
  1096.                 xbyte2:=Port[xword + 5];
  1097.                 Port[xword + 5]:=xbyte;
  1098.                 if xbyte2 <> $AA then
  1099.                   xbyte3:=1
  1100.                 else
  1101.                   begin
  1102.                   Port[$3C4]:=$12;
  1103.                   xbyte:=Port[$3C5];
  1104.                   Port[$3C5]:=xbyte and $BF;
  1105.                   xbyte2:=Port[$3C5] and $40;
  1106.                   if xbyte2 <> 0 then
  1107.                     begin
  1108.                     Port[$3C5]:=xbyte;
  1109.                     xbyte3:=2;
  1110.                     end
  1111.                   else
  1112.                     begin
  1113.                     Port[$3C5]:=xbyte or $40;
  1114.                     xbyte2:=Port[$3C] and $40;
  1115.                     if xbyte2 = 0 then
  1116.                       begin
  1117.                       Port[$3C5]:=xbyte;
  1118.                       xbyte3:=2;
  1119.                       end
  1120.                     else
  1121.                       begin
  1122.                       Port[$3C5]:=xbyte;
  1123.                       xbyte3:=4;
  1124.                       Port[$3C4]:=$10;
  1125.                       xbyte:=Port[$3C5];
  1126.                       Port[$3C5]:=xbyte and $FB;
  1127.                       xbyte2:=Port[$3C5] and 4;
  1128.                       if xbyte2 <> 0 then
  1129.                         xbyte3:=3;
  1130.                       Port[$3C5]:=xbyte or 4;
  1131.                       xbyte2:=Port[$3C5] and 4;
  1132.                       if xbyte2 = 0 then
  1133.                         xbyte3:=3;
  1134.                       Port[$3C5]:=xbyte;
  1135.                       end
  1136.                     end
  1137.                   end;
  1138.                 Writeln(parachips[xbyte3]);
  1139.                 Port[$3CE]:=$0B;
  1140.                 for xbyte:=1 to 2 do;
  1141.                 xbyte:=Port[$3CF];
  1142.                 vidmem:=word(64) * (xbyte shr 4);
  1143.                 caption3('Video');
  1144.                 d8or16bit((xbyte and 4) = 0);
  1145.                 caption3('ROM');
  1146.                 d8or16bit((xbyte and 2) = 0);
  1147.                 caption3('Frequencies are');
  1148.                 Port[$3CE]:=$0F;
  1149.                 xbyte:=Port[$3CF];
  1150.                 if (xbyte and $80) = $80 then
  1151.                   Writeln('multi-sync')
  1152.                 else
  1153.                   Writeln('fixed-sync');
  1154.                 Port[xword + 4]:=$29;
  1155.                 Port[xword + 5]:=paralock2;
  1156.                 Port[$3CE]:=$F;
  1157.                 Port[$3CF]:=paralock1;
  1158.                 end;
  1159.               end;
  1160.             if vgacard = standard then
  1161.               begin
  1162.               ClrEol;
  1163.               dontknow;
  1164.               end;
  1165.             end;
  1166.           captfont;
  1167.           showfont($01);
  1168.           showfont($02);
  1169.           showfont($03);
  1170.           showfont($04);
  1171.           showfont($05);
  1172.           showfont($06);
  1173.           showfont($07);
  1174.           int101210;
  1175.           saveattr:=TextAttr;
  1176.           savex:=WhereX;
  1177.           savey:=WhereY;
  1178.           TextColor(LightRed + Blink);
  1179.           Write('**Retrieving palette information**');
  1180.           with regs do
  1181.             begin
  1182.             AX:=$1009;
  1183.             ES:=seg(VGAbuf);
  1184.             DX:=ofs(VGAbuf);
  1185.             intr($10, regs)
  1186.             end;
  1187.           GotoXY(savex, savey);
  1188.           Write('                                  ');
  1189.           GotoXY(savex, savey);
  1190.           TextAttr:=saveattr;
  1191.           caption2('Palette registers');
  1192.           for i:=$00 to $0F do
  1193.             Write(hex(VGAbuf[i], 2), ' ');
  1194.           Writeln;
  1195.           caption2('Border color');
  1196.           Write(hex(VGAbuf[$10], 2));
  1197.           caption3('Color page');
  1198.           with regs do
  1199.             begin
  1200.             AX:=$101A;
  1201.             intr($10, regs);
  1202.             Write('$', hex(BH, 2));
  1203.             caption3('Paging mode');
  1204.             case BL of
  1205.               $00 : Writeln('4 pages of 64 registers');
  1206.               $01 : Writeln('16 pages of 16 registers')
  1207.               else
  1208.                 unknown('mode', BL, 2)
  1209.             end
  1210.             end
  1211.         end;
  1212.     PC3270 : begin
  1213.              Writeln('3270 PC');
  1214.              captfont
  1215.              end
  1216.   else
  1217.     unknown('adapter', graphdriver, 4)
  1218.   end {case}
  1219.   end; {page06}
  1220. end.
  1221.